package com.cuddleclones.imagedepot.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cuddleclones.imagedepot.model.Users;
import com.cuddleclones.imagedepot.mapper.UsersMapper;
import com.cuddleclones.imagedepot.service.UsersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhoushuang
 * @since 2021-07-02
 */
@Service
@Transactional
public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements UsersService {

    @Autowired
    private UsersMapper usersMapper;

    @Override
    public IPage<Users> selectPage(Page<Users> page, Users users) {
        QueryWrapper<Users> queryWrapper = new QueryWrapper<Users>();
        getQueryWrapper(queryWrapper,users);
        return usersMapper.selectPage(page,queryWrapper);
    }

    @Override
    public List<Users> selectList(Users users) {
        QueryWrapper<Users> queryWrapper = new QueryWrapper<Users>();
        getQueryWrapper(queryWrapper,users);
        return usersMapper.selectList(queryWrapper);
    }

    /**
     *  公共查询条件
     * @param queryWrapper
     * @return
     */
    public QueryWrapper<Users> getQueryWrapper(QueryWrapper<Users> queryWrapper,Users users){
        //条件拼接
    
        return queryWrapper;
    }
}
